import React, { Component } from 'react'
import './index.css';
import axios from 'axios';
export default class VideoDetail extends Component {
    state = {
        video: {}
    }
    render() {
        return (
            <div className="container"> 
                <h3>{this.state.video.desc}</h3>
                <hr />
                <div className="video">
                    <video controls src={'http://cdn.xiaohigh.com' + this.state.video.video_local}></video>
                </div>
            </div>
        )
    }

    async componentDidMount(){
        let id = 12;
        //发送请求获取视频的详细信息
        let {data} = await axios('http://api.xiaohigh.com:8090/douyin/' + id);
        //保存数据到 state
        this.setState({
            video: data
        })
    }
}
